﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Web;

namespace CodeCamp.Infrastructure
{
    public static class MailHelper
    {

        public static void SendMail(string recipient, string subject, string body)
        {
            SendMail(new List<string>() {recipient}, subject, body);
        }

        public static void SendMail(IEnumerable<string> recipients, string subject, string body)
        {

            var message = new MailMessage();

            foreach (var recipient in recipients)
                message.To.Add(recipient);

            message.Subject = subject;
            message.Body = body;
            message.IsBodyHtml = true;

            var mailClient = new SmtpClient();
            mailClient.Send(message);

        }

    }
}